home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / totdem.arc / DEMMN8.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-10  |  1KB  |  63 lines

  1. program DemoMenuEight;
  2. {DEMMN8 - reading a menu from disk}
  3. USES  DOS, CRT,
  4.       totMENU, totFAST, totLINK;
  5.  
  6. var
  7.   Menu: EZPullLinkOBJ;
  8.   Choice: word;
  9.  
  10. procedure CreateMenu;
  11. {}
  12. var
  13.   FileList: StrDLLOBJ;
  14.   Retcode: integer;
  15.   F: text;
  16.   Line:string;
  17. begin
  18.    assign(F,'DEMMN8.TXT');
  19.    {$I-}
  20.    reset(F);
  21.    {$I+}
  22.    if ioresult <> 0 then
  23.    begin
  24.       Writeln('Error: the file DEMMN8.TXT must be in the default directory!');
  25.       halt(1);
  26.    end;
  27.    with FileList do
  28.    begin
  29.       Init;
  30.       Retcode := 0;
  31.       ReadLn(F,Line);
  32.       while not eof(F) and (Retcode = 0) do
  33.       begin
  34.          Readln(F,Line);
  35.          Retcode := Add(Line);
  36.       end;
  37.       close(F);
  38.    end;
  39.    with Menu do
  40.    begin
  41.       Init;
  42.       AssignList(FileList);
  43.       FileList.Done;
  44.    end;
  45. end; {CreateMenu}
  46.  
  47. begin
  48.    Screen.PartClear(1,2,80,24,white,'░'); {paint the screen}
  49.    Screen.PartClear(1,1,80,1,31,' ');
  50.    Screen.PartClear(1,25,80,25,31,' ');
  51.    Screen.WritePlain(9,25,'│');
  52.    CreateMenu;
  53.    with Menu do
  54.    begin
  55.       Choice := Push(13,0,0);   {Pass Enter to make menu pull down}
  56.       Done;
  57.    end;
  58.    GotoXY(25,15);
  59.    if Choice = 0 then
  60.       Writeln('You escaped')
  61.    else
  62.       Writeln('You selected menu item ',Choice);
  63. end.